package com.tql.test_10;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class StreamTest {
    public static void main(String[] args) {
        User user = new User(18,"hell",1);
        User user1 = new User(24,"hell",2);
        User user2= new User(6,"hell",3);
        User user3= new User(40,"hell",4);
        List<User> list = Arrays.asList(user, user2, user1, user3);
        //stream流式计算 、链式编程、lambad表达式
        list.stream().filter((u)->{ return u.getId()%2==0;})
                .filter((u)->{return u.getAge()>23;})
                .limit(1)
                .forEach((u)->{
                    System.out.println(u);
                });
        System.out.println(list);
    }
}
